tail-call-optimisation

36 views
Skip to first unread message

Simon Harris

unread,
Dec 24, 2009, 5:19:02 AM12/24/09
to rubinius-dev
Does rubinius perform any kind of TOC or are there any plans?

evanphx

unread,
Dec 24, 2009, 11:21:44 AM12/24/09
to rubinius-dev
Hi Simon,

On Dec 24, 2:19 am, Simon Harris <haruki.zae...@gmail.com> wrote:
> Does rubinius perform any kind of TOC or are there any plans?

We currently do not do any tail call optimizations. One big reason is
that tail call optimizations typically destroy proper backtrace
information. I consider that an unacceptable side-effect for any kind
of automatic tail call detection.

I might consider some explicit tail call tagging, where the user
understands that using it means confusing backtraces.

A simple syntax like:

return Rubinius.tailcall obj.method(....)

would maybe be acceptable.

- Evan

Simon Harris

unread,
Dec 24, 2009, 2:43:09 PM12/24/09
to rubinius-dev
I understand the rationale but explicit TOC is, IMHO, nasty. How about
a VM-wide switch instead? Then I've made it explicit that I accept the
consequences of the optimisation. I can then develop on the small
without TOC and execute on the large with it. It also means the code
is technically portable to other implementations.

Of course were an explicit call required, I'd probably use it anyway
and implement it on other platforms as a stub :/

Kevin Clark

unread,
Dec 25, 2009, 11:41:20 AM12/25/09
to rubini...@googlegroups.com
Maybe a '-O' makes sense in general for optimizations that are going
to make debugging ugly?


--
Kevin Clark
http://glu.ttono.us

Simon Harris

unread,
Dec 26, 2009, 5:27:53 PM12/26/09
to rubinius-dev
+1

Simon Harris

unread,
Dec 27, 2009, 5:43:07 PM12/27/09
to rubinius-dev
On Dec 25, 3:21 am, evanphx <evanw...@gmail.com> wrote:
>
> A simple syntax like:
>
>   return Rubinius.tailcall obj.method(....)
>

If having an explicit method would speed acceptance, I'd be happy to
compromise :)

Is this something I could do in Ruby or will it require C++? The
former I can have a go at; the latter not so much :/

Reply all
Reply to author
Forward
0 new messages